/*!
    \file       elec_solver.cpp
    \modified	02/14/11
    \copyright  (c) Diego F Andrade (diegoandrade@gmail.com)
    \licence    GPL
    \brief      Describes matrix class
    \author     Diego F Andrade
    \date	02/14/11
 */

#include "elec_solver.h"

//const double pi = 4*atan(1); // Constant value for PI
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

elecslvr::elecslvr()
{
	
}

elecslvr::~elecslvr() 
{
	
}

float elecslvr::centroide(float p1, float p2, float p3)
{
    float c = 0.0;    
    c = 1/(float)3 *(p1+p2+p3);    
    return c;
    
}

// This is the area of a triangle when only coordinates are given
float elecslvr::area_triangle(point p1,point p2, point p3)
{
    float area = 0.0;
    area = 1/(float)2*abs((p1.x-p3.x)*(p2.y-p1.y)-(p1.x-p2.x)*(p3.y-p1.y));
    return area;
    
}

float elecslvr::distance_between_vertex(point p1, point p2)
{
    float distance = 0.0;    
    distance = sqrt(pow((p2.x-p1.x),2)+pow((p2.y-p1.y),2));    
    return distance;
    
}

void elecslvr::delta_vertex(point p1, point p2)
{
    deltx = abs(p1.x-p2.x);
    delty = abs(p1.y-p2.y);
    
    //this will change the global value of deltx everytime that this function is called I dont kwnow if that is correct in my program yet!
   
}
